﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;

using RZD_maps.Modules.Map.Services;
using RZD_maps.Modules.Map.Views;
using RZD_maps.Infrastructure;


namespace RZD_maps.Modules.Map
{
    public class MapModule : IModule
    {
        private readonly IRegionManager regionManager;
        private readonly IUnityContainer container;

        public MapModule(IUnityContainer container, IRegionManager regionManager)
        {
            this.container = container;
            this.regionManager = regionManager;
        }

        public void Initialize()
        {
            this.container.RegisterType<IMapsRepository, MapsRepository>(new ContainerControlledLifetimeManager());

            // Show the Orders Editor view in the shell's main region.
            this.regionManager.RegisterViewWithRegion("MapsRegion",
                                                       () => this.container.Resolve<MapsView>());

//            // Show the Orders Toolbar view in the shell's toolbar region.
//            this.regionManager.RegisterViewWithRegion("GlobalCommandsRegion",
//                                                       () => this.container.Resolve<OrdersToolBar>());

        }
    }
}
